import { NgModule } from '@angular/core';
import { HomeComponent } from './home/home.component';
import { Routes, RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { CloudSharedModule } from '../../shared/shared.module';
import { ConfigService } from '../../core/common/config.service';

import { PortalService } from './homepage/service/portal.service';
import { Http, XSRFStrategy, XHRBackend, RequestOptions } from '@angular/http';
import { LocalXSRFStrategy } from '../../core/http/local-xsrf-strategy.service';
import { httpFactory } from '../../core/http/http.factory';
import { EchartsNg2Module } from '../../shared/component/echarts-ng2';
import { AgreementModule } from '../agreement/agreement.module';
import { ChannelPortalComponent } from './homepage/channelportal/channelportal.component';
import { ManagerPortalComponent } from './homepage/managerportal/manager-portal.component';
import { SalesPortalComponent } from './homepage/salesportal/salesportal.component';
import { UserPortalComponent } from './homepage/userportal/userportal.component';
import { Router } from '@angular/router';
const routes: Routes = [
  { path: '', component: HomeComponent },
];

@NgModule({
  imports: [
    CloudSharedModule,
    RouterModule.forChild(routes),
    EchartsNg2Module,
    AgreementModule,
    FormsModule
  ],
  declarations: [UserPortalComponent, SalesPortalComponent, ManagerPortalComponent, ChannelPortalComponent, HomeComponent],
  exports: [
    RouterModule
  ],
  providers: [ConfigService, PortalService,
    {
      provide: XSRFStrategy, useClass: LocalXSRFStrategy,
    },
    {
      provide: Http,
      useFactory: httpFactory,
      deps: [XHRBackend, RequestOptions, ConfigService, Router]
    }
  ]
})
export class HomeModule { }
